package org.springblade.common.enums.library;

/**
 * @Author: junxin
 * @Date: 2023/5/18
 * @Description: 题目难度
 */
public enum DifficultyLevel {
	/**
	 * 初级
	 */
	PRIMARY("初级", 1),
	/**
	 * 中级
	 */
	INTERMEDIATE("中级", 2),
	/**
	 * 高级
	 */
	SENIOR("高级", 3),


	;

	/**
	 * 值
	 */
	private String value;
	/**
	 * 编码
	 */
	private Integer code;


	DifficultyLevel(String value, Integer code) {
		this.value = value;
		this.code = code;
	}

	public String getValue() {
		return value;
	}


	public Integer getCode() {
		return code;
	}

	public static Integer getCodeByValue(String value){
		for (DifficultyLevel difficultyLevel:DifficultyLevel.values()){
			if (difficultyLevel.getValue().equals(value))return difficultyLevel.getCode();
		}
		return null;
	}
}
